<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.dumpChildFrames();
}

function getExpectedLastModified(lastModified) {
    var date = new Date(lastModified);
    if (isNaN(date.getTime()))
      return "illformed-date";
    var month = ('0' + (date.getMonth() + 1)).slice(-2);
    var day = ('0' + date.getDate()).slice(-2);
    var hour = ('0' + date.getHours()).slice(-2);
    var minute = ('0' + date.getMinutes()).slice(-2);
    var second = ('0' + date.getSeconds()).slice(-2);
    var result = month + '/' + day + '/' + date.getFullYear() + ' ' + hour + ':' + minute + ':' + second;
    return result;
}

function test(text) {
    var url = '../resources/last-modified.php?date=' + escape(text) + '&expected=' + escape(getExpectedLastModified(text));
    document.write('<iframe id="test" src="' + url + '"></iframe>');
}

test('Mon, 21 Nov 2008 01:03:33 GMT');
test('Tuesday, 21 Nov 2008 01:03:33 GMT');
test('Mon, 21 Nov 97 01:03:33 GMT');
test('Mon, 21-Nov-2008 01:03:33 GMT');
test('Mon, 21-Feb-2008 01:03:33 GMT');
test('Mon, 03-Feb-2008 01:03:33 GMT');
test('Mon, 3-Mar-2008 01:03:33 GMT');
test('Something ill-formed');
</script>
